FROM java:8-jdk-alpine

# 基本环境变量设置
ENV JFINAL_HOME=/jfinal \
    DEPLOY=/jfinal/deploy \
    HTML=/jfinal/html \
    CONF=/jfinal/conf \
    LOG_DIR=/jfinal/logs \
    SERVER_PORT=8081 \
    TZ=Asia/Shanghai

# 创建应用根目录
RUN set -ex; \
    mkdir -p "$DEPLOY" "$HTML" "$CONF" "$LOG_DIR"; \
    ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# 拷贝应用程序至镜像
COPY ./target/jfinal_run_by_jar-dependencies.jar $JFINAL_HOME/

# 增加挂载点
VOLUME ["$CONF", "$LOG_DIR"]

# 暴露端口
EXPOSE $SERVER_PORT

# 运行启动命令
CMD java -jar \
    $JFINAL_HOME/jfinal_run_by_jar-dependencies.jar \
    --deploy=$DEPLOY \